﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DomainDriver.CommonUtilities.Collections;
using DomainDriver.CommonUtilities.Reflectors;

namespace DomainDriver.DomainModeling.DomainObjects
{
    public abstract class KeyedDomainObjectBase<KEY, KEYED_DOMAIN_OBJECT> : DomainObjectBase<KEYED_DOMAIN_OBJECT>, IKeyedDomainObject<KEY, KEYED_DOMAIN_OBJECT>
        where KEYED_DOMAIN_OBJECT : class, IKeyedDomainObject<KEY, KEYED_DOMAIN_OBJECT>
    {
        #region IKeyedDomainObject Implementation

        protected KEY m_Key = default(KEY);

        public virtual KEY Key
        {
            get { return m_Key; }
        }

        #endregion

        #region Object Overrides

        public override int GetHashCode()
        {
            return Key.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            return base.Equals(obj);
        }

        public override string ToString()
        {
            return Key.ToString();
        }

        #endregion
    }
}